/**
 * 
 */
package com.wolfware.athsweb.manager.impl;

import com.wolfware.athsweb.domain.AbstractCompetitionResult;
import com.wolfware.athsweb.domain.Competition;
import com.wolfware.athsweb.manager.CompetitionResultManager;
import com.wolfware.athsweb.persistancy.dao.CompetitionDAO;

/**
 * @author ChristianStrzadala
 *
 */
public class CompetitionResultManagerImpl implements CompetitionResultManager {

	private CompetitionDAO competitionDAO;
	
	/**
	 * @param competitionDAO the competitionDAO to set
	 */
	public void setCompetitionDAO(final CompetitionDAO competitionDAO) {
		this.competitionDAO = competitionDAO;
	}

	/**
	 * {@inheritDoc}
	 */
	public void addCompetitionResult(Long compId, AbstractCompetitionResult competitionResult) {
		Competition competition =  competitionDAO.getCompetitionById(compId);
		
		competition.addCompetitionResult(competitionResult);
		
		competitionDAO.updateCompetitionEntry(competition);
	}

}
